package c_api
import (
	"github.com/gin-gonic/gin"
	"github.com/objcoding/wxpay"
	"gintest/until"
)
func Pay_wx(c *gin.Context){
	// 新建微信支付客户端
	account:=wxpay.NewAccount("wxb4ba3c02aa476XXX", "1230000109", "apiKey", true) // sandbox环境请传true
	client := wxpay.NewClient(account)
	// 统一下单
	params := make(wxpay.Params)
	params.SetString("body", "test").
			SetString("out_trade_no", "436577857").
			SetInt64("total_fee", 1).
			SetString("spbill_create_ip", "127.0.0.1").
			SetString("notify_url", "http://notify.objcoding.com/notify").
			SetString("trade_type", "APP")
	p, _ := client.UnifiedOrder(params)
	until.Success(c,p)
}